import { IPSDataEntity } from '../dataentity/ipsdata-entity';
import { IPSDEAction } from '../dataentity/action/ipsdeaction';
import { IPSDEField } from '../dataentity/defield/ipsdefield';
import { IPSSysDTSQueue } from './ipssys-dtsqueue';
import { IPSSystemModule } from '../system/ipssystem-module';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysDTSQueueImpl extends PSModelObjectImpl implements IPSSysDTSQueue {
  protected cancelpsdeaction: IPSDEAction | null = null;

  getCancelPSDEAction(): IPSDEAction | null {
    if (this.cancelpsdeaction != null) return this.cancelpsdeaction;
    const value = this.M.getCancelPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.cancelpsdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.cancelpsdeaction;
  }

  get cancelPSDEAction(): IPSDEAction | null {
    return this.getCancelPSDEAction();
  }

  getCancelPSDEActionMust(): IPSDEAction {
    const value = this.getCancelPSDEAction();
    if (value == null) {
      throw new Error('未指定取消操作实体行为');
    }
    return value;
  }

  get cancelTimeout(): number {
    return this.M.cancelTimeout != null ? this.M.cancelTimeout : -1;
  }

  get cancelledState(): string {
    return this.M.cancelledState || '41';
  }

  get codeName(): string {
    return this.M.codeName;
  }

  protected confirmpsdeaction: IPSDEAction | null = null;

  getConfirmPSDEAction(): IPSDEAction | null {
    if (this.confirmpsdeaction != null) return this.confirmpsdeaction;
    const value = this.M.getConfirmPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.confirmpsdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.confirmpsdeaction;
  }

  get confirmPSDEAction(): IPSDEAction | null {
    return this.getConfirmPSDEAction();
  }

  getConfirmPSDEActionMust(): IPSDEAction {
    const value = this.getConfirmPSDEAction();
    if (value == null) {
      throw new Error('未指定确认操作实体行为');
    }
    return value;
  }

  get createdState(): string {
    return this.M.createdState || '10';
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  protected errorpsdefield: IPSDEField | null = null;

  getErrorPSDEField(): IPSDEField | null {
    if (this.errorpsdefield != null) return this.errorpsdefield;
    const value = this.M.getErrorPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.errorpsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.errorpsdefield;
  }

  get errorPSDEField(): IPSDEField | null {
    return this.getErrorPSDEField();
  }

  getErrorPSDEFieldMust(): IPSDEField {
    const value = this.getErrorPSDEField();
    if (value == null) {
      throw new Error('未指定错误属性对象');
    }
    return value;
  }

  get failedState(): string {
    return this.M.failedState || '40';
  }

  get finishedState(): string {
    return this.M.finishedState || '30';
  }

  protected historypsdataentity: IPSDataEntity | null = null;

  getHistoryPSDataEntity(): IPSDataEntity | null {
    if (this.historypsdataentity != null) return this.historypsdataentity;
    const value = this.M.getHistoryPSDataEntity;
    if (value == null) {
      return null;
    }
    this.historypsdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getHistoryPSDataEntity') as IPSDataEntity;
    return this.historypsdataentity;
  }

  get historyPSDataEntity(): IPSDataEntity | null {
    return this.getHistoryPSDataEntity();
  }

  getHistoryPSDataEntityMust(): IPSDataEntity {
    const value = this.getHistoryPSDataEntity();
    if (value == null) {
      throw new Error('未指定历史数据实体对象');
    }
    return value;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psdataentity: IPSDataEntity | null = null;

  getPSDataEntity(): IPSDataEntity | null {
    if (this.psdataentity != null) return this.psdataentity;
    const value = this.M.getPSDataEntity;
    if (value == null) {
      return null;
    }
    this.psdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getPSDataEntity') as IPSDataEntity;
    return this.psdataentity;
  }

  get psDataEntity(): IPSDataEntity | null {
    return this.getPSDataEntity();
  }

  getPSDataEntityMust(): IPSDataEntity {
    const value = this.getPSDataEntity();
    if (value == null) {
      throw new Error('未指定实体对象');
    }
    return value;
  }

  protected pssystemmodule: IPSSystemModule | null = null;

  getPSSystemModule(): IPSSystemModule | null {
    if (this.pssystemmodule != null) return this.pssystemmodule;
    const value = this.M.getPSSystemModule;
    if (value == null) {
      return null;
    }
    this.pssystemmodule = this.getPSModel4('system.IPSSystemModule', value, 'getPSSystemModule') as IPSSystemModule;
    return this.pssystemmodule;
  }

  get psSystemModule(): IPSSystemModule | null {
    return this.getPSSystemModule();
  }

  getPSSystemModuleMust(): IPSSystemModule {
    const value = this.getPSSystemModule();
    if (value == null) {
      throw new Error('未指定系统模块');
    }
    return value;
  }

  get processingState(): string {
    return this.M.processingState || '20';
  }

  protected pushpsdeaction: IPSDEAction | null = null;

  getPushPSDEAction(): IPSDEAction | null {
    if (this.pushpsdeaction != null) return this.pushpsdeaction;
    const value = this.M.getPushPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.pushpsdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.pushpsdeaction;
  }

  get pushPSDEAction(): IPSDEAction | null {
    return this.getPushPSDEAction();
  }

  getPushPSDEActionMust(): IPSDEAction {
    const value = this.getPushPSDEAction();
    if (value == null) {
      throw new Error('未指定推送实体行为');
    }
    return value;
  }

  protected refreshpsdeaction: IPSDEAction | null = null;

  getRefreshPSDEAction(): IPSDEAction | null {
    if (this.refreshpsdeaction != null) return this.refreshpsdeaction;
    const value = this.M.getRefreshPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.refreshpsdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.refreshpsdeaction;
  }

  get refreshPSDEAction(): IPSDEAction | null {
    return this.getRefreshPSDEAction();
  }

  getRefreshPSDEActionMust(): IPSDEAction {
    const value = this.getRefreshPSDEAction();
    if (value == null) {
      throw new Error('未指定刷新实体行为');
    }
    return value;
  }

  get refreshTimer(): number {
    return this.M.refreshTimer != null ? this.M.refreshTimer : -1;
  }

  protected statepsdefield: IPSDEField | null = null;

  getStatePSDEField(): IPSDEField | null {
    if (this.statepsdefield != null) return this.statepsdefield;
    const value = this.M.getStatePSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.statepsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.statepsdefield;
  }

  get statePSDEField(): IPSDEField | null {
    return this.getStatePSDEField();
  }

  getStatePSDEFieldMust(): IPSDEField {
    const value = this.getStatePSDEField();
    if (value == null) {
      throw new Error('未指定状态属性对象');
    }
    return value;
  }

  protected timepsdefield: IPSDEField | null = null;

  getTimePSDEField(): IPSDEField | null {
    if (this.timepsdefield != null) return this.timepsdefield;
    const value = this.M.getTimePSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.timepsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.timepsdefield;
  }

  get timePSDEField(): IPSDEField | null {
    return this.getTimePSDEField();
  }

  getTimePSDEFieldMust(): IPSDEField {
    const value = this.getTimePSDEField();
    if (value == null) {
      throw new Error('未指定时间属性对象');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSSysDTSQueueImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dts.IPSSysDTSQueue') return true;
    return super.instanceof(cls);
  }
}
